using System;
using System.Collections.Generic;
using System.Text;

namespace UML01
{
    public enum Course
    {
        Algorithm, English, OOP
    }

    public class Person
    {
        private string _name;

        public string getName()
        {
            return _name;
        }

        public Person(string name)
        {
            _name = name;
        }
    }

    public interface IProfessor
    {
        void do_teach(Course c);
    }

    public class Professor : Person, IProfessor
    {
        private string _title;

        public Professor(string name, string title)
            : base(name)
        {
            _title = title;
        }

        public void do_research()
        {
            Console.WriteLine(base.getName() + " does research.");
        }

        #region IProfessor Members

        public void do_teach(Course c)
        {
            Console.WriteLine(base.getName() + " is teaching for " + c.ToString() + ".");
        }

        #endregion
    }

    public class University
    {
        private List<Professor> teachers = new List<Professor>();

        public University()
        {
            teachers.Add(new Professor("Ruonan Rao", "Chair Professor"));
            teachers.Add(new Professor("Linpeng Huang", "Chair Professor"));
        }

        public void DoWork()
        {
            foreach (Professor teacher in teachers)
            {
                switch (teacher.getName())
                {
                    case "Ruonan Rao":
                        teacher.do_teach(Course.OOP);
                        break;
                    case "Linpeng Huang":
                        teacher.do_teach(Course.Algorithm);
                        break;
                    default:
                        Console.WriteLine(teacher.getName() + " is free.");
                        break;
                }

                teacher.do_research();
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            University sjtu = new University();
            sjtu.DoWork();

            Console.WriteLine("Press any key to end...");
            Console.ReadKey(true);
        }
    }
}
